<?php 
include('../../include/functions.inc.php');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Asignacion de Estudiantes</title>
        <link href="../../bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
        <link href="../../css/ContentStyle.css" rel="stylesheet" type="text/css" />
        <link href="../../css/tableorderer.css" rel="stylesheet" type="text/css" />
        <script src="../../js/jquery.js" type="text/javascript"></script>
        <script>jQuery.noConflict();</script>
        <script src="../../bootstrap/js/bootstrap.js"></script>
    </head>

    <body>

        <?php
        
        $sql = "SELECT * FROM cllg_student_assign WHERE id =" . $_GET['asigned'] . "";
        $info = $db->queryToArray($sql);
        $sql_student = "SELECT * FROM cllg_student WHERE id ='" . $info[0]['FK_STUDENT'] . "'";
        $info_student = $db->queryToArray($sql_student);
        $sql_career = "SELECT * FROM cllg_career WHERE id ='" . $info[0]['FK_CAREER'] . "'";
        $info_career = $db->queryToArray($sql_career);

        $sql_pensum = "SELECT * FROM cllg_pensum WHERE FK_CAREER ='" . $info_career[0]['ID'] . "'";
        $info_pensum = $db->queryToArray($sql_pensum);
        ?>
        <div id="tabs">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="">RESUMEN DE LA ASIGNACION</a>
                </li>
            </ul>
        </div>
        <div id="tab-cont">
            <form>
            <table class=""  width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th width="50%">
                        &nbsp;
                    </th>
                    <th width="50%" scope="col" valign="middle">
                        <input type="button"  name="cmdNext" id="cmdNext" class="btn btn-info" value="&nbsp;Continuar&nbsp;"onClick="window.location.href='index.php'" />
                    </th>
                </tr>
                <tr>
                    <td colspan="2">	
                        <div id="cursosList" style="width:60%; margin:0 auto;" >

                            <br/><table width="60%" cellpadding="0" cellspacing="1" class="table table-striped table-hover" align="center" >
                                <tbody>
                                    <tr>
                                        <th align="center" >CARNET</th>
                                        <th align="left" >NOMBRE DEL ESTUDIANTE</th>
                                        <th >CARRERA</th>
                                        <th >PENSUM</th>
                                    </tr>
                                    <tr>
                                        <td align="center" ><?= $info_student[0]["ID"] ?></td>
                                        <td align="left" ><?= $info_student[0]["FIRST_NAME"] ?> &nbsp; <?= $info_student[0]["SECOND_NAME"] ?> &nbsp; <?= $info_student[0]["LAST_NAME"] ?></td>
                                        <td ><?= $info_career[0]["NAME"] ?></td>
                                        <td ><?= $info_pensum[0]["CODE_RELEASE"] ?></td>
                                    </tr>	
                                    <tr>
                                        <th align="center" ></th>
                                        <th align="left" ># CICLO</th>
                                        <th >CURSO</th>
                                        <th >SECCION</th>
                                    </tr>


                                    <?php
                                    $sql_detail = "SELECT * FROM cllg_assign_detail WHERE FK_ASSIGN ='" . $_GET['asigned'] . "'";
                                    $info_detail = $db->queryToArray($sql_detail);

    //print_r($info_detail);

                                    foreach ($info_detail as $key => $value) {
                                        $sql_course = "SELECT * FROM cllg_courses_catalog WHERE CODE ='" . $info_detail[$key]['FK_COURSE'] . "'";
                                        $info_course = $db->queryToArray($sql_course);

                                        $sql_cycle = "SELECT * FROM cllg_courses_pensum WHERE FK_COURSE ='" . $info_detail[$key]['FK_COURSE'] . "'";
                                        $sql_cycle = $db->queryToArray($sql_cycle);
                                        echo '<tr>
                                                      <td align="center" ></td>
                                                      <td align="left" >' . $sql_cycle[0]["CYCLE"] . '</td>
                                                      <td >' . $info_course[0]["NAME"] . '</td>
                                                      <td >' . $info_detail[$key]["SECTION"] . '</td>
                                                    </tr>';
                                    }
                                    ?>		

                                </tbody>
                            </table>
                         </div>
                    </td>
                </tr>
             </form>
        </div>    
    </body>
</html> 